import Vue from 'vue'
import VueRouter from 'vue-router'
import homePage from '../views/homePage.vue'

Vue.use(VueRouter)

// 首页部分
const routes = [{
    path: '/',
    redirect: '/homePage',
  },
  {
    path: "/my",
    name: "my",
    component: () => import("../views/my.vue"),
    beforeEnter: (to, from, next) => {
      let Signin = localStorage.getItem("password");
      if (!Signin) {
        next("/SignIn");
        return;
      } else {
        next();
      }
    }
  },
  {
    path: "/Ranking",
    name: "Ranking",
    component: () => import("../views/Ranking.vue"),
    beforeEnter: (to, from, next) => {
      let Signin = localStorage.getItem("password");
      if (!Signin) {
        next("/SignIn");
        return;
      } else {
        next();
      }
    }
  },

  {
    path: "/SignIn",
    name: "SignIn",
    meta: {
      TabbarShow: true
    },
    component: () => import("../views/SignIn.vue")
  },
  {
    path: '/homePage',
    name: 'homePage',
    component: homePage,
  },
  {
    path: "/homePage/Recommended",
    name: "Recommended",
    meta: {
      TabbarShow: true
    },
    component: () => import("../components/homeList/Recommended.vue")
  },




  {
    path: '/searchResult',
    name: 'searchResult',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/Lists/searchResult.vue')
  },





  {
    path: '/RankingList',
    name: 'RankingList',
    meta: {
      TabbarShow: true
    },
    children: [{
        path: "/RankingList",
        redirect: "comprehensive"
      },
      //综合榜
      {
        path: 'comprehensive',
        name: 'comprehensive',
        meta: {
          TabbarShow: true
        },
        component: () => import('../components/homeList/comprehensive.vue')
      },
      // 自制榜
      {
        path: 'self',
        name: 'self',
        meta: {
          TabbarShow: true
        },
        component: () => import('../components/homeList/self.vue')
      },
      // 少年榜
      {
        path: 'juvenile',
        name: 'juvenile',
        meta: {
          TabbarShow: true
        },
        component: () => import('../components/homeList/juvenile.vue')
      },
      // 少女榜
      {
        path: 'girl',
        name: 'girl',
        meta: {
          TabbarShow: true
        },
        component: () => import('../components/homeList/girl.vue')
      },
      // 新作榜
      {
        path: 'works',
        name: 'works',
        meta: {
          TabbarShow: true
        },
        component: () => import('../components/homeList/works.vue')
      },
      // 黑马榜
      {
        path: 'horse',
        name: 'horse',
        meta: {
          TabbarShow: true
        },
        component: () => import('../components/homeList/horse.vue')
      },
      // 免费榜
      {
        path: 'free',
        name: 'free',
        meta: {
          TabbarShow: true
        },
        component: () => import('../components/homeList/free.vue')
      },
      // 付费榜
      {
        path: 'pay',
        name: 'pay',
        meta: {
          TabbarShow: true
        },
        component: () => import('../components/homeList/pay.vue')
      },
      // 完结榜
      {
        path: 'end',
        name: 'end',
        meta: {
          TabbarShow: true
        },
        component: () => import('../components/homeList/end.vue')
      },
      // 连载榜
      {
        path: 'Serial',
        name: 'Serial',
        meta: {
          TabbarShow: true
        },
        component: () => import('../components/homeList/Serial.vue')
      },
    ],
    component: () => import('../components/homeList/RankingList.vue')
  },

  // 分类
  {
    path: '/classifi',
    name: 'classifi',
    meta: {
      TabbarShow: true
    },
    children: [{
      path: 'popularity',
      name: 'popularity',
      meta: {
        TabbarShow: true
      },
      component: () => import('../components/homeList/popularity.vue')
    }, ],
    component: () => import('../components/homeList/classifi.vue')
  },
  {
    path: '/ComicContent',
    name: 'ComicContent',
    meta: {
      TabbarShow: true
    },
    component: () => import('../views/ComicContent.vue')
  },



  {
    path: '/classification',
    name: 'classification',
    component: () => import('../views/classification.vue')
  },


  {
    path: '/find',
    name: 'find',
    component: () => import('../views/find.vue'),
    children: [{
        path: '/find',
        redirect: "image"
      },
      // 图片
      {
        path: 'image',
        name: 'image',
        component: () => import('../components/findList/image.vue')
      },
      // 咨询
      {
        path: 'consulting',
        name: 'consulting',
        component: () => import('../components/findList/consulting.vue')
      },
      // 人物
      {
        path: 'character',
        name: 'character',
        component: () => import('../components/findList/character.vue')
      },
    ]
  },
  {
    path: '/xq',
    name: 'xq',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/xq.vue')
  },



  // 业界
  {
    path: '/find/industry',
    name: 'industry',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/industry.vue')
  },
  // 情报
  {
    path: '/find/cuttingEdgeNews',
    name: 'cuttingEdgeNews',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/cuttingEdgeNews.vue')
  },
  // 漫评
  {
    path: '/find/evaluate',
    name: 'evaluate',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/evaluate.vue')
  },
  // 专题
  {
    path: '/find/special',
    name: 'special',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/special.vue')
  },

  // 海报
  {
    path: '/find/poster',
    name: 'poster',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/poster.vue')
  },
  // 壁纸
  {
    path: '/find/wallpaper',
    name: 'wallpaper',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/wallpaper.vue')
  },
  // 美女
  {
    path: '/find/beauty',
    name: 'beauty',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/beauty.vue')
  },
  // COSPLAY
  {
    path: '/find/COSPLAY',
    name: 'COSPLAY',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/COSPLAY.vue')
  },
  // 手办
  {
    path: '/find/GarageKit',
    name: 'GarageKit',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/GarageKit.vue')
  },
  // 四格漫画
  {
    path: '/find/Four',
    name: 'Four',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/Four.vue')
  },


  {
    path: '/find/author',
    name: 'author',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/author.vue')
  },
  {
    path: '/find/role',
    name: 'role',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/role.vue')
  },
  {
    path: '/find/dubbing',
    name: 'dubbing',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/findList/dubbing.vue')
  },



  {
    path: '/details',
    name: 'details',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/Lists/details.vue')
  },
  {
    path: '/homePage/search',
    name: 'search',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/Lists/search.vue')
  },
  {
    path: '/my/BooklList',
    name: 'BooklList',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/Lists/BooklList.vue')
  },
  {
    path: '/my/establish',
    name: 'establish',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/Lists/establish.vue')
  },
  {
    path: '/my/RevisionList',
    name: 'RevisionList',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/Lists/RevisionList.vue')
  },
  {
    path: '/my/VoucherCenter',
    name: 'VoucherCenter',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/Lists/VoucherCenter.vue')
  },
  {
    path: '/my/UserAgreement',
    name: 'UserAgreement',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/Lists/UserAgreement.vue')
  },
  {
    path: '/my/Feedback',
    name: 'Feedback',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/Lists/Feedback.vue')
  },
  {
    path: '/my/contactUs',
    name: 'contactUs',
    meta: {
      TabbarShow: true
    },
    component: () => import('../components/Lists/contactUs.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router